home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
challenge
/
12.09-Sep96
/
Testcode96.09R1.sit.hqx
/
Testcode96.09R1
/
4 MiscByteCodes
/
MiscByteCodes.java
< prev
next >
Wrap
Text File
|
1996-08-20
|
1KB
|
89 lines
import java.applet.Applet;
public class MiscByteCodes extends Applet
{
int localVar;
public void start()
{
int returnVal = myTest();
System.out.println( "Correct result is "+Integer.toString(returnVal ) );
}
private int myNonVirtualMethod()
{
return localVar+1;
}
public int myTest()
{
int result;
int i1 = 10;
int i2 = 12;
int i3 = 15;
int i4;
short s1 = 20;
short s2 = 22;
short s3 = 25;
short s4;
short s5 = 3;
byte b1 = 19;
byte b2 = 24;
byte b3 = 30;
byte b4;
char c1,c3;
char c2 = 'y';
i4 = i1+i2;
i4 -= i3;
i4 *= i1;
i4 /= 3;
i4 %= 17;
s4 = (short)(s1+s2);
b4 = (byte)(b1+b2-b3);
c1 = 'x';
if (c1==c2) c3 = 'y';
else c3 = 'n';
if (c1>c2) c3 = 'y';
else c3 = 'n';
if (c1<c2) c3 = 'y';
else c3 = 'n';
if (c1<=c2) c3 = 'y';
else c3 = 'n';
if (c1>=c2) c3 = 'y';
else c3 = 'n';
if (c1!=c2) c3 = 'y';
else c3 = 'n';
i4 <<=2;
i4>>=3;
b4>>=2;
s4<<=3;
s4>>=2;
i2 = i3&i4;
++i2; // misalign next switch statement
switch (i2) {
case 0: i2 +=1;
case 1: i2 +=2;
case 2: i2 +=4;
default: i2+=8;
}
localVar = i2;
i2 += myNonVirtualMethod();
result = i4+b4+s4+i2;
return result;
}
}